<?php
/**
 * Create By: PhpStorm
 * User: yihua
 * File: UpdateUserAddress.php
 * Date: 2017/1/6
 * Time: 0:08
 */

namespace app\api\model\page\user;

use app\api\model\dao\UserAddress;
use app\library\PageBase;
use app\library\Error;

class UpdateUserAddress extends PageBase
{
    private $objUserAddressModel;

    public function __construct()
    {
        parent::__construct();
        $this->objUserAddressModel = new UserAddress();
    }

    public function excute($param)
    {
        $ret = $this->checkToken($param);
        if (false === $ret) {
            return $this->getRes(Error::ERR_SYS);
        }

        if (empty($param['address_id']) || empty($param['user_id'])) {
            return $this->getRes(Error::ERR_PARAM);
        }
        $res = $this->objUserAddressModel->updateAddress($param);
        if (false === $res) {
            return $this->getRes(Error::ERR_USER_ADDRES_UPDATE);
        } else {
            return $this->getRes();
        }
    }
}



